<template>
  <div>
    <a
      href="javascript:;"
      @click="
        skipRouter({
          path: item.path ? '/' + item.path : '/awardDetail',
          query: { awardId: item.awardId },
        })
      "
      class="NewsList-content-item van-hairline--bottom"
      v-for="(item, index) in list"
      :key="index"
    >
      <div class="news-poster">
        <img :src="imgUrl + item.titleImg" alt />
      </div>
      <div class="news-top">
        <div class="news-top-title van-ellipsis">{{ item.title }}</div>
      </div>
    </a>
  </div>
</template>
<script>
export default {
  name: "awardItem",
  props: {
    list: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  data() {
    return {
      imgUrl: config.imgUrl,
    };
  },
  methods: {
    skipRouter(routerObj) {
      this.$router.push(routerObj);
    },
  },
};
</script>
<style lang="scss" scoped>
@import "@/assets/css/base";
.NewsList-content-item {
  display: block;
  margin-top: px2rem(40);
  padding-bottom: px2rem(30);
  .news-top {
    width: 100%;
    @include flex();
    &-title {
      width: px2rem(400);
      font-size: px2rem(36);
      color: #000000;
      font-weight: 400;
      margin-left: px2rem(20);
    }
    & > .isTop {
      width: px2rem(140);
      background: url("./../../assets/img/news/top.png") left center no-repeat;
      background-size: px2rem(15) px2rem(17);
      box-sizing: border-box;
      padding-left: px2rem(30);
      font-size: px2rem(20);
      color: #ff0000;
    }
  }
  .news-poster {
    margin: px2rem(20) 0;
    position: relative;
    width: 100%;
    & > img {
      width: px2rem(690);
      // height: px2rem(332);
      height: px2rem(450);
      border-radius: 5px;
      display: block;
      // object-fit: none;
    }
    &-date {
      position: absolute;
      bottom: 0;
      right: 0;
      width: px2rem(187);
      height: px2rem(35);
      background: rgba(0, 0, 0, 0.5);
      border-radius: px2rem(10) 0 px2rem(10) 0;
      text-align: center;
      line-height: px2rem(35);
      font-size: px2rem(20);
      color: #ffffff;
    }
  }
  .news-content {
    width: 100%;
    font-size: px2rem(24);
    color: #848484;
    line-height: 1.7;
  }
}
</style>